@{    ViewBag.Title = "大小写转换器_人民币大写在线转换工具";
    ViewBag.keywords = "大小写转换器,人民币大写在线转换工具";
    ViewBag.description = "人民币大写在线转换工具可为银行汇款单、支票、合同等提供金额大写转换、大写数字转换。";
var host = Appsettings.app("BaseFile:HostUrl");}
 
<blockquote class="layui-elem-quote">
    <h3>人民币大小写转换器（在线将阿拉伯数字转换成中文大写、数字汉字大写）</h3>
</blockquote>
<div class="layui-row layui-form layui-form-pane">
<div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输入小写数字金额：</label>
        <div class="layui-input-block">
            <textarea name="Digits" id="Digits" rows="4" autocomplete="off" class="layui-textarea" size="31" maxlength="11"></textarea>
        </div>
</div>
    <div class="layui-form-item">
        <a class="layui-btn layui-btn-sm" onclick="Result.value = convertCurrency(Digits.value);">转换为大写金额</a>
        <a class="layui-btn layui-btn-sm copy" >复制到粘贴板</a>
@*        <a class="layui-btn layui-btn-normal dec">解密</a>
        <a class="layui-btn layui-btn-danger cle">清空</a>
        <a class="layui-btn layui-btn-primary copy">复制结果</a>*@
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">显示中文大写金额：</label>
        <div class="layui-input-block">
          <textarea id="Result" size="40" name="Result" rows="4" autocomplete="off" class="layui-textarea" style="font-size:16px;"></textarea>
          <input id="Result_hidden" name="Result_hidden" hidden="">
        </div>
    </div>
</div>
    <div class="Instructionst">
        <div class="a"><strong>金额大写转换器的使用说明：</strong>
            <br>1、首先将小写数字填写或者复制到“输入小写数字金额”中。（不得用中文数字填写，必须使用用阿拉伯数字填写。）<br>
            2、然后点击“转换为大写金额”的按钮，即可将输入的金额转换为大写数字。例如：输入“123456”，点击转换按钮后即可自动转换为大写金额“壹拾贰万叁仟肆佰伍拾陆元整”。<br>
            3、最后点击“复制到粘贴板”按钮，把转换完成的大写数字内容复制到所需填写的地方粘贴即可。<br>
            <br>注意：输入的数字可以包含小数点（例如9999.99），也可以写成千进制（例如9,999.99），小写数字中的逗号和点必须是英文符号。<br><br>
    <div id="containerId" style="border:1px solid #999; margin-bottom:20px;"></div>
	<table class="layui-table" cellspacing="0" cellpadding="0" border="0">
		<thead><tr><th>币种</th><th>缩写</th><th>货币符号</th></tr></thead>
		<tbody>
			<tr>
				<td>人民币</td><td>RMB(CNY)</td><td>¥</td>
			</tr>
			<tr>
				<td>美元</td><td>USD</td><td>$</td>
			</tr>
			<tr>
				<td>欧元</td><td>EUR</td><td>€</td>
			</tr>
			<tr>
				<td>英镑</td><td>GBP</td><td>￡</td>
			</tr>
		</tbody>
	</table>
	（货币符号可直接鼠标选中复制后使用）。
	</div></div>
    
	<h2>数字大写转换对应大写表_小写转大写(红色字可选中复制使用)</h2>
    <table class="layui-table"><tr>
			  <tbody><tr>
				<th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>0</th><th>十</th><th>百</th><th>千</th>
			  </tr>
			  <tr>
				<td>壹</td><td>贰</td><td>叁</td><td>肆</td><td>伍</td><td>陆</td><td>柒</td><td>捌</td><td>玖</td><td>零</td><td>拾</td><td>佰</td><td>仟</td>
			  </tr></tbody></table>
    <div class="Instructions"><strong>人民币大写-使用说明：</strong><br>1、正确的大写金额数字为：壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿、元、角、分、零、整(正)等。<br>2、中文大写金额数字前应加上“人民币”字样，大写金额数字紧接“人民币”字样，不可留有空白。例如：人民币贰拾万陆仟元零柒角伍分。</div>
    <h2>财务金额大写常用金额单位(位数)对应表</h2>
 <table class="layui-table">
     <tr>
    	<td> 亿 = <b class="red">亿</b></td>
        <td> 万 = <b class="red">万</b></td>
        <td> 千 = <b class="red">仟</b></td>
        <td>百 = <b class="red">佰</b></td>
    	<td>十 = <b class="red">拾</b></td>
        <td>元 = <b class="red">圆</b></td>
        <td>角 = <b class="red">角</b></td>
        <td>分 = <b class="red">分</b></td>
        <td> 正 = <b class="red">正</b></td>
        <td> 整 = <b class="red">整</b></td></tr>
</table>
    <div class="Instructions"><strong>大小写转换-使用说明：</strong>
        <br>1、大写金额以「元」结尾的，应在最后写「整」（或「正」）结尾；<br>2、以「角」结尾的，结尾可以不写「整」（或「正」）；<br>3、以「分」结尾的，结尾不写「整」（或「正」）；
    </div>

@section Scripts{
<script>
    layui.config({ base: '@host/js/' }).use('jquery',function(){ $=layui.jquery;  
      $(".copy").bind("click", function () {
          let area_output = document.getElementById('Result');
          var txt = area_output.value; 
          if (txt === undefined || txt === '' || txt === null) { layer.msg("没有输出内容.", { icon: 2 }); return; }
          if (XEClipboard.copy(txt)) { layer.msg("复制成功.", { icon: 1 }); }
          else { layer.msg("复制失败.", { icon: 2 }); }
      });
});
    
   function convertCurrency(currencyDigits) { 
    var MAXIMUM_NUMBER = 99999999999.99; 
    // Predefine the radix characters and currency symbols for output: 
    var CN_ZERO = "零"; 
    var CN_ONE = "壹"; 
    var CN_TWO = "贰"; 
    var CN_THREE = "叁"; 
    var CN_FOUR = "肆"; 
    var CN_FIVE = "伍"; 
    var CN_SIX = "陆"; 
    var CN_SEVEN = "柒"; 
    var CN_EIGHT = "捌"; 
    var CN_NINE = "玖"; 
    var CN_TEN = "拾"; 
    var CN_HUNDRED = "佰"; 
    var CN_THOUSAND = "仟"; 
    var CN_TEN_THOUSAND = "万"; 
    var CN_HUNDRED_MILLION = "亿"; 
    var CN_SYMBOL = ""; 
    var CN_DOLLAR = "元"; 
    var CN_TEN_CENT = "角"; 
    var CN_CENT = "分"; 
    var CN_INTEGER = "整"; 
     
// Variables: 
    var integral;    // Represent integral part of digit number. 
    var decimal;    // Represent decimal part of digit number. 
    var outputCharacters;    // The output result. 
    var parts; 
    var digits, radices, bigRadices, decimals; 
    var zeroCount; 
    var i, p, d,ds; 
    var quotient, modulus; 
     
// Validate input string: 
    currencyDigits = currencyDigits.toString(); 
    if (currencyDigits == "") { 
        alert("不能为空 请输入数字金额!如：123.23"); 
        return ""; 
    } 
    if (currencyDigits.match(/[^,.\d]/) != null) { 
        alert("输入字符串中的字符无效!"); 
        return ""; 
    } 
    if ((currencyDigits).match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/) == null) { 
        alert("请输入正确的数字金额!"); 
        return ""; 
    } 
     
// Normalize the format of input digits: 
    currencyDigits = currencyDigits.replace(/,/g, "");    // Remove comma delimiters. 
    currencyDigits = currencyDigits.replace(/^0+/, "");    // Trim zeros at the beginning. 
    // Assert the number is not greater than the maximum number. 
    if (Number(currencyDigits) > MAXIMUM_NUMBER) { 
        alert("数值太大无法转换!"); 
        return ""; 
    } 
     
// Process the coversion from currency digits to characters: 
    // Separate integral and decimal parts before processing coversion: 
    parts = currencyDigits.split("."); 
    if (parts.length > 1) { 
        integral = parts[0]; 
        decimal = parts[1]; 
        // Cut down redundant decimal digits that are after the second. 
        decimal = decimal.substr(0, 2); 
    } 
    else { 
        integral = parts[0]; 
        decimal = ""; 
    } 
    // Prepare the characters corresponding to the digits: 
    digits = new Array(CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, CN_NINE); 
    radices = new Array("", CN_TEN, CN_HUNDRED, CN_THOUSAND); 
    bigRadices = new Array("", CN_TEN_THOUSAND, CN_HUNDRED_MILLION); 
    decimals = new Array(CN_TEN_CENT, CN_CENT); 
    // Start processing: 
    outputCharacters = ""; 
    // Process integral part if it is larger than 0: 
    if (Number(integral) > 0) { 
        zeroCount = 0; 
        for (i = 0; i < integral.length; i++) { 
            p = integral.length - i - 1; 
            d = integral.substr(i, 1); 
            quotient = p / 4; 
            modulus = p % 4; 
            if (d == "0") { 
                zeroCount++; 
            } 
            else { 
                if (zeroCount > 0) 
                { 
                    outputCharacters += digits[0]; 
                } 
                zeroCount = 0; 
                outputCharacters += digits[Number(d)] + radices[modulus]; 
            } 
            if (modulus == 0 && zeroCount < 4) { 
                outputCharacters += bigRadices[quotient]; 
            } 
        } 
        outputCharacters += CN_DOLLAR; 
    } 
    // Process decimal part if there is: 
    if (decimal != "") { 
        for (i = 0; i < decimal.length; i++) { 
            d = decimal.substr(i, 1); 
            ds=decimal.substr(-1, 1);
			if(d==0){
				if(ds==0){
					outputCharacters += "";
					}
				else{
				outputCharacters += digits[Number(d)];
				}
				}
			else{
				
			outputCharacters += digits[Number(d)] + decimals[i];
			
			}
        } 
    } 
    // Confirm and return the final output string: 
    if (outputCharacters == "") { 
        outputCharacters = CN_ZERO + CN_DOLLAR; 
    } 
    if (decimal == "") { 
        outputCharacters += CN_INTEGER; 
    } 
    outputCharacters = CN_SYMBOL + outputCharacters; 
    return outputCharacters; 
}
   </script>
}